home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Shareware / Programare / sharp / wwwSharp_setup.exe / {app} / Examples / Data access / DataBindings (DataView) / DataBindings.wsits (.txt) < prev    next >
Windows Compiled HTML Help File  |  2003-12-23  |  10KB  |  75 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4.     <TITLE>www-Sharp.ClrHost DataView example</TITLE>
  5.     <META name="GENERATOR" content="MSHTML 6.00.2800.1264">
  6.     <META http-equiv="MSThemeCompatible" content="Yes">
  7.     <OBJECT id="myDSO" classid="clsid:E3BC8FCA-E3F4-4B98-8627-9D3D343F9DA0">
  8.         <PARAM name="AssemblyName"
  9.             value="System.Data, Version=1.0.5000.0, PublicKeyToken=b77a5c561934e089, Culture=neutral">
  10.         <PARAM name="DataAdapterTypeName" value="System.Data.SqlClient.SqlDataAdapter">
  11.         <PARAM name="ConnectionTypeName" value="System.Data.SqlClient.SqlConnection">
  12.         <PARAM name="ConnectionString" value="Integrated Security=SSPI;Database=Northwind;">
  13.         <PARAM name="CommandText" value="Select * from [Customers]">
  14.         <PARAM name="UseView" value="true">
  15.         <PARAM name="Filter" value="CustomerID < 'S'">
  16.         <PARAM name="Sort" value="ContactName">
  17.         <PARAM name="RowStateFilter" value="CurrentRows">
  18.     </OBJECT>
  19. <STYLE>
  20. TH
  21. {
  22.     background-color: #99CC33;
  23. }
  24.  
  25. TD
  26. {
  27.     background-color: #00FF99;
  28. }
  29.  
  30. BUTTON
  31. {
  32.     width: 100px;
  33. }
  34. </STYLE>
  35. <SCRIPT>
  36. window.onload = Fill;
  37.  
  38. function Fill()
  39. {
  40.     var i;
  41.     var str = "<TABLE id=\"tblCustomers\" dataSrc=\"#myDSO\" border=\"0\" width=\"100%\" dataPageSize=\"10\">\r\n";
  42.  
  43.     var rs = myDSO.recordset;
  44.     if (rs == null)
  45.     {
  46.         window.alert("Recordset is not valid");
  47.         return;
  48.     }
  49.     str += "<THEAD>\r\n<TR>\r\n";
  50.     for (i = 0; i < rs.Fields.Count; i++)
  51.         str += "<TH>" + rs.Fields.Item(i).Name + "</TH>\r\n";
  52.     str += "</TR>\r\n</THEAD>\r\n";
  53.  
  54.     str += "<TBODY>\r\n<TR>\r\n";
  55.     for (i = 0; i < rs.Fields.Count; i++)
  56.         str += "<TD><SPAN dataFld=\"" + rs.Fields.Item(i).Name + "\"></SPAN></TD>\r\n";
  57.     str += "</TR>\r\n</TBODY>\r\n";
  58.     
  59.     str += "</TABLE>";
  60.  
  61.     tblCustomers.outerHTML = str;
  62. }
  63. </SCRIPT>
  64. </HEAD>
  65. <BODY>
  66.     <BUTTON id="btnFirst" onclick="tblCustomers.firstPage()">< <</BUTTON>
  67.     <BUTTON id="btnPrev" onclick="tblCustomers.previousPage()"><</BUTTON>
  68.     <BUTTON id="btnNext" onclick="tblCustomers.nextPage()">></BUTTON>
  69.     <BUTTON id="btnLast" onclick="tblCustomers.lastPage()">> ></BUTTON> 
  70.     <TABLE id="tblCustomers">
  71.         <TBODY></TBODY>
  72.     </TABLE>
  73. </BODY>
  74. </HTML>
  75.